import request from '@/utils/request'

// 获取文章列表
export function getArticleListApi(query: any) {
    return request({
        url: '/article',
        method: 'get',
        params: query
    })
}

// 依据文章id删除文章
export function deleteArticleApi(id: number) {
    return request({
        url: `/article/${id}`,
        method: 'delete'
    })
}

// 依据文章id获取文章详情
export function getArticleDetailApi(id: number) {
    return request({
        url: `/article/${id}`,
        method: 'get'
    })
}

// 新增文章
export function postArticleApi(data: any) {
    return request({
        url: '/article',
        method: 'post',
        data
    })
}

// 修改文章
export function putArticleApi(data: any) {
    return request ({
        url: `/article/${data.id}`,
        method: 'put',
        data
    })
}